const {getTop250Http, handleStar,getLunHttp} = require("../../http/http")
const{http} = require('../../utils/index')
Page({

   
    data: {
        songs:[],
        music:[],
        autoplay:true,
        interval:3000,
        duration:1200,
        data:[]
    },

    
    onLoad() {
        var data = `http://localhost:4000/api/banner`
        http({
            url: data,
            success: res => {
                console.log(res.data.res );
                var data = res.data.res
                this.setData({
                    data
                })
            }
        })
        getTop250Http().then(res=>{
            var songs = res.data;
            var music=[]
           songs.forEach(item=>{
               var{_id,pic,title,rating}=item;
               var xinxin = rating;
               music.push({
                   _id,
                   rating,
                   pic,
                   xinxin:handleStar(xinxin),
                   title
               })
           })
           this.setData({
               music
           })
        })
    },
    handleItem(event){
        var{aid} = event.currentTarget.dataset;
        wx.navigateTo({
            url:`/pages/detail/detail?id=${aid}`
        })
    }

})